package com.ruoyi.project.bajiaostar.tUserAddress.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.bajiaostar.tUserAddress.mapper.TUserAddressMapper;
import com.ruoyi.project.bajiaostar.tUserAddress.domain.TUserAddress;
import com.ruoyi.project.bajiaostar.tUserAddress.service.ITUserAddressService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 用户收货地址Service业务层处理
 * 
 * @author wangwu
 * @date 2024-03-04
 */
@Service
public class TUserAddressServiceImpl implements ITUserAddressService 
{
    @Autowired
    private TUserAddressMapper tUserAddressMapper;

    /**
     * 查询用户收货地址
     * 
     * @param id 用户收货地址ID
     * @return 用户收货地址
     */
    @Override
    public TUserAddress selectTUserAddressById(Long id)
    {
        return tUserAddressMapper.selectTUserAddressById(id);
    }

    /**
     * 查询用户收货地址列表
     * 
     * @param tUserAddress 用户收货地址
     * @return 用户收货地址
     */
    @Override
    public List<TUserAddress> selectTUserAddressList(TUserAddress tUserAddress)
    {
        return tUserAddressMapper.selectTUserAddressList(tUserAddress);
    }

    /**
     * 新增用户收货地址
     * 
     * @param tUserAddress 用户收货地址
     * @return 结果
     */
    @Override
    public int insertTUserAddress(TUserAddress tUserAddress)
    {
        tUserAddress.setCreateTime(DateUtils.getNowDate());
        return tUserAddressMapper.insertTUserAddress(tUserAddress);
    }

    /**
     * 修改用户收货地址
     * 
     * @param tUserAddress 用户收货地址
     * @return 结果
     */
    @Override
    public int updateTUserAddress(TUserAddress tUserAddress)
    {
        tUserAddress.setUpdateTime(DateUtils.getNowDate());
        return tUserAddressMapper.updateTUserAddress(tUserAddress);
    }

    /**
     * 删除用户收货地址对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteTUserAddressByIds(String ids)
    {
        return tUserAddressMapper.deleteTUserAddressByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户收货地址信息
     * 
     * @param id 用户收货地址ID
     * @return 结果
     */
    @Override
    public int deleteTUserAddressById(Long id)
    {
        return tUserAddressMapper.deleteTUserAddressById(id);
    }
}
